package com.jmb.apiplatform.pojo;


import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.DecimalMax;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;


@NoArgsConstructor
@AllArgsConstructor
@Data
@Schema(description = "用户实体类")
public class UserDao implements Serializable {
    @Schema(description ="用户id")
    private Integer userId;
    @Schema(description ="账号名")
    @Size(min = 1, max = 20, message = "用户名长度在1-20之间")
    @NotNull(message = "用户名不能为空")
    private String username;
    @Schema(description ="账号密码")
    @NotNull(message = "密码不能为空")
    private String password;
    @Schema(description ="工号")
    @Pattern(regexp = "^[0-9]{4,10}$", message = "工号必须是4-10位的数字")
    private String job;
    @Schema(description ="性别")
    @DecimalMax(value = "1", message = "性别只能是0或1")
    private Integer sex;
    @Schema(description ="状态")
    @DecimalMax(value = "1", message = "状态只能是0或1")
    private Integer enable;
    @Schema(description ="创建时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createdTime;
    @Schema(description ="修改时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
    @Schema(description ="真实姓名")
    @Size(max = 20,message = "姓名长度必须小于20")
    private String name;
    @Schema(description ="角色id")
    private Integer roleId;
}